package com.xu.blog_after_end.service;

import com.xu.blog_after_end.dao.UserRepository;
import com.xu.blog_after_end.po.User;
import com.xu.blog_after_end.util.MD5Utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService{
    @Autowired
    private UserRepository userRepository;
    @Override
    public User checkUser(String username, String password) {
         User user = userRepository.findByUsernameAndPassword(username, MD5Utils.code(password)); //连接数据库  对密码进行md5加密
        return user;
    }
    @Override
    public User getUserInfo() {
         return userRepository.findFirstByOrderByIdAsc();
    }

}
